﻿using System;
using System.Collections.Generic;
using System.Text;
using TaiLieu;

namespace TaiLieu
{
    public class Sessions
    {
        /// <summary>
        ///     public static string IdProducts
        /// </summary>
        public static string MessageResult
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._SessionResult))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._SessionResult));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._SessionResult, value);
            }
        }
        /// <summary>
        ///   public static Users CurrentUser
        /// </summary>
        public static Users CurrentUser
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._SessionUserInfo))
                    return ManagementSession.GetSession(KeySession._SessionUserInfo) as Users;
                return null;
            }
            set { 
                ManagementSession.SetSession(KeySession._SessionUserInfo,value); }
        }
        /// <summary>
        /// list id product in cart
        /// </summary>
        public static string IdProducts
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._SessionIdProducts))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._SessionIdProducts));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._SessionIdProducts, value);
            }
        }
        /// <summary>
        ///  public static string CacMonHoc
        /// </summary>
        public static string CacMonHoc
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._SessionmonHoc))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._SessionmonHoc));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._SessionmonHoc, value);
            }
        }
       /// <summary>
        ///  public static string BaoMat
        /// </summary>
        public static string BaoMat
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._MaBaoMat))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._MaBaoMat));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._MaBaoMat, value);
            }
        }
        /// <summary>
        /// = true if language = vn
        /// </summary>
        public static bool LanguageVN
        {
            get
            {
                return ConvertType.ToBool(ManagementSession.GetSession(KeySession._SessionLanguage));
            }
            set
            {
                ManagementSession.SetSession(KeySession._SessionLanguage, value);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public static string UrlFrontend
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._SessionUrlFrontend))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._SessionUrlFrontend));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._SessionUrlFrontend, value);
            }
        }
       
        public static string UrlAdmin
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._SessionUrlAdmin))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._SessionUrlAdmin));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._SessionUrlAdmin, value);
            }
        }
        /// <summary>
        /// dùng dể xác định nhanh path trên admin
        /// </summary>
        public static string link
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._link))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._link));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._link, value);
            }
        }        
        public static string Add
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession._SSnAdd))
                    return ConvertType.ToString(ManagementSession.GetSession(KeySession._SSnAdd));
                return "";
            }
            set
            {
                ManagementSession.SetSession(KeySession._SSnAdd, value);
            }
        }
        public static bool enable
        {
            get
            {
                return ConvertType.ToBool(ManagementSession.GetSession(KeySession._SessionEnable));
            }
            set
            {
                ManagementSession.SetSession(KeySession._SessionEnable, value);
            }
        }
        public static string pathFolderImage
        {
            get
            {
                return ConvertType.ToString(ManagementSession.GetSession(KeySession._pathFolderImage));
            }
            set
            {
                ManagementSession.SetSession(KeySession._pathFolderImage, value);
            }
        }
       
        public static Members  members
        {
            get
            {
                if (ManagementSession.ContainsInSession(KeySession.member))
                    return ManagementSession.GetSession(KeySession.member) as Members;
                return null;
            }
            set
            {
                ManagementSession.SetSession(KeySession.member, value);
            }
        }
        public static int maXacThuc
        {
            get
            {
                return ConvertType.ToInt(ManagementSession.GetSession(KeySession.maXacThuc));
            }
            set
            {
                ManagementSession.SetSession(KeySession.maXacThuc, value);
            }
        }

        public static string search
        {
            get
            {
                return ConvertType.ToString(ManagementSession.GetSession(KeySession.search));
            }
            set
            {
                ManagementSession.SetSession(KeySession.search, value);
            }
        }
      
    }
}
